import TJavaLib.TList;
import TJavaLib.TPoint;

public class TGSMRPacket extends TPacket {
	public TList sgList;
	public String sAddr, fAddr;
	
	public TGSMRPacket(TList sgList) {
		super(TPacket.GSMR);
		this.sgList = sgList;
	}
	
	public TGSMRPacket(TGSMRPacket packet) {
		super(TPacket.GSMR);
		if (packet.sgList != null) {
			sgList = new TList();
			for (int i=0; i<packet.sgList.len(); i++) {
				sg_struct sg2 = (sg_struct)packet.sgList.get(i);
				sg_struct sg1 = new sg_struct();
				if (sg2.dAddrs != null) {
					sg1.dAddrs = new TList();
					for (int j=0; j<sg2.dAddrs.len(); j++) {
						String s = (String)sg2.dAddrs.get(j);
						sg1.dAddrs.enList(s);
					}
				}
				if (sg2.finalAddrs != null) {
					sg1.finalAddrs = new TList();
					for (int j=0; j<sg2.finalAddrs.len(); j++) {
						String s = (String)sg2.finalAddrs.get(j);
						sg1.finalAddrs.enList(s);
					}
				}
				if (sg2.dCoors != null) {
					sg1.dCoors = new TList();
					for (int j=0; j<sg2.dCoors.len(); j++) {
						TPoint p2 = (TPoint)sg2.dCoors.get(j);
						TPoint p = new TPoint(p2.x, p2.y);
						sg1.dCoors.enList(p);
					}
				}
				sg1.rAddr = sg2.rAddr;
				sg1.blAddr = sg2.blAddr;
				sg1.varphi = sg2.varphi;
				sg1.blSign = sg2.blSign;
				sg1.d2des = sg2.d2des;
				sg1.lastRepCoor = new TPoint(sg2.lastRepCoor.x, sg2.lastRepCoor.y);
				sgList.enList(sg1);
			}
		}
		sAddr = packet.sAddr;
		fAddr = packet.fAddr;
	}
}
